package com.zipking.cloud.springbootmybatis.service;

import com.alibaba.fastjson.JSONObject;
import org.springframework.stereotype.Component;

import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.BlockingQueue;

@Component
public class RequestQueue<T> {

    /**
     * 获取开门记录队列
     */
    BlockingQueue<JSONObject> blockingQueue = new ArrayBlockingQueue<>(1000000,true);


    /**
     * 获取请求队列数据
     */
    public BlockingQueue<JSONObject> getBlockingQueue(){
        return blockingQueue;
    }



    /**
     * 保存数据进入队列
     */
    public void putJsonDataQueue(JSONObject jsonObject){
        try {
            getBlockingQueue().put(jsonObject);

        }catch (Exception e){
            e.printStackTrace();
        }

    }

}

